#ifndef __PINS_SCHEME_H__
#define __PINS_SCHEME_H__

#include <bitset>

class PinScheme
{
public:
    const static size_t PIN_COUNT = 10;
    
public:
    PinScheme()
    {
        _pins.reset();
    }
    
    PinScheme(const std::string& mask)
    {
        setMarkedPins(mask);
    }
    
    void applyMarkedPins(const std::bitset<PIN_COUNT>& mask)
    {
        _pins |= mask;        
    }
    
    void applyMarkedPins(const std::string& mask)
    {
        applyMarkedPins(std::bitset<PIN_COUNT>(mask));
    }
    
    void uncheckPins(const std::bitset<PIN_COUNT>& mask)
    {
        _pins ^= mask;
    }
    
    void uncheckPins(const std::string& mask)
    {
        uncheckPins(std::bitset<PIN_COUNT>(mask));
    }
    
    void setMarkedPin(int pinNumber)
    {
        _pins.set(pinNumber, true);
    }
    
    void setMarkedPins(const std::bitset<PIN_COUNT>& mask)
    {
        _pins = mask;
    }
    
    void setMarkedPins(const std::string& mask)
    {
        setMarkedPins(std::bitset<PIN_COUNT>(mask));
    }
    
    int getMarkedCount() const
    {
        return _pins.count();
    }
    
    PinScheme&& toKnocked(const PinScheme& scheme) const
    {
        PinScheme knocked = *this;
        knocked._pins = ~(knocked._pins | scheme._pins);
        return std::move(knocked);
    }
    
    void print() const
    {
        std::cout << _pins.to_string() << std::endl;
    }
    
private:
    std::bitset<PIN_COUNT> _pins;
    
    //& & & &
    // & & &
    //  & &
    //   &
};



#endif